import Api from 'api';
import bffApi from 'fetch';

class WebApi {
    queryUsers = (params = {})=>Api({
        url: 'proxyOrder/users',
        method: 'POST',
        body: Object.assign({}, params)
    })


    queryGoodsList = (params = {})=>Api({
        url: 'proxyOrder/goods',
        method: 'POST',
        body: Object.assign({}, params)
    })


    cartConfirmCheck = (params)=>bffApi('/trade/cartConfirmCheck', 'POST', params)


    confirmInit = ()=>bffApi('/trade/confirmInit', 'POST', {})


    saveReceipt = (params = {})=>bffApi('/accounts/deliver_address', 'POST', params)

    queryShipFee = (params = {})=>bffApi('/trade/ship_fee', "POST", params)

    querySelfAddress = (params = {})=>bffApi('/address/list', 'POST', params)

    createTrade = (params)=>bffApi('/trade/save', 'POST', params);


    getToken = (userId = '')=>Api({
        url: `token/${userId}`,
        method: 'POST',
        body: {}
    })

    queryDetail = (tid = '') => Api({
        url: `order/detail/${tid}`,
        method: 'GET'
    })
}

export default new WebApi();